package com.wiz.web.controllor;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.wiz.web.service.AbcService;
import com.wiz.web.service.TestService;

@Controller
@RequestMapping("/test")
public class TestControllor {

	@Resource
	private TestService testService;
	@Resource
	private AbcService abcService;

	/**
	 * 支付宝回调接口
	 * @param request
	 * @return
	 */
	@RequestMapping(value="/t",method=RequestMethod.GET)
    @ResponseBody
	public String test(HttpServletRequest request,
			@RequestParam(value = "p") String p){
		try {
			System.out.println("controllor="+p+"     "+Thread.currentThread().getId());
			return testService.wxBarPay(request,p);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return "server error";
		}
    }
	
	@RequestMapping(value="/abc",method=RequestMethod.GET)
    @ResponseBody
	public String abc(HttpServletRequest request,
			@RequestParam(value = "p") String p){
		try {
			return abcService.wxBarPay(request,p);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return "server error";
		}
    }
}
